import java.util.ArrayList;

public class JavaDemo {
    public static void main(String[] args) {
        test();
    }

    public static void test() {
        double l;
        long start = System.currentTimeMillis();
        for (int i = 0; i < 50; i++) {
            l = fibImp(5000);
        }
        long then = System.currentTimeMillis();
//        System.out.println("spend time:" + (then - start));
        for (int i = 0; i < 50; i++) {
            l = fibImp(5000);
        }
        long now = System.currentTimeMillis();
        System.out.println("spend time:" + (now - then));
    }

    private static double fibImp(int i) {
        double result = 0D;
        for (int j = 0; j < i; j++) {
            result = result * j + result;
        }
        return result;
    }
}